 <script src="__PUBLIC__/js/bootstrap-datepicker.min.js"></script>
 <script src="__PUBLIC__/locales/bootstrap-datepicker.zh-CN.min.js" charset="UTF-8"></script>
 <link id="bsdp-css" href="__PUBLIC__/css/bootstrap-datepicker3.min.css" rel="stylesheet">
 <script type="text/javascript">
     $(function () {
        $('[data-toggle="tooltip"]').tooltip();
        $('input[name="packageend"]').datepicker({
            format: "yyyy-mm-dd",
            todayBtn: "linked",
            language: "zh-CN",
            autoclose: true
        }).on('changeDate', function(ev) {
            //alert(ev.date.valueOf());
            var packageend = ev.date.valueOf();
            $.get("__APP__/Userlevel/getpackageend/userid/{$userid}/packageend/"+packageend,function(e){
                var recordprice = parseInt($('#single').html()) ;
                //alert(recordprice);
                $("#countlimit").html(e.countlimit);
                $('#package').html("￥"+recordprice*parseInt(e.countlimit));
            });
        });

        $("select[name='level']").change(function(){
            var level = $("select[name='level']").val();
            $.get("__APP__/Userlevel/getprice/level/"+level,function(e){
                $('#single').html(e.recordprice);
                $('#multi').html(e.subprice);
                $('#discuss').html(+e.discussprice);
                var recordprice = e.recordprice;
                var count = parseInt($('#countlimit').text()) ;
                $('#package').html(recordprice*count);
            });
        });
    });


 </script>

 <div class="row">
                <div class="col-lg-12">
                    <h3 class="page-header"><i class="fa fa-chevron-left" onclick="closeurl();"></i>用户评论管理</h3>
                </div>
                <!-- /.col-lg-12 -->
            </div>

            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-green">
                        <div class="panel-heading">
                            用户简介
                        </div>
                        <div class="panel-body">
                            <div class="media">
                              <div class="media-left">
                                <a href="#">
                                  <img class="media-object" src="<if condition="$user.image eq ''">{$user.headimgurl}<else />{$user.image}</if>" alt="用户头像" width="100">
                                </a>
                              </div>
                              <div class="media-body">
                                <h4 class="media-heading"><b>{$user.name}</b></h4>
                                <p>
                                {:L('hospital')}:{$user.hospital}
                                {:L('address')}:{$user.address}
                                </p>
                                <p>
                                {:L('department')}:{$user.department}
                                {:L('position')}:{$user.position}
                                {:L('socialposition')}:{$user.socialposition}
                                </p>
                                <p>
                                {:L('mobile')}:{$user.mobile}
                                {:L('email')}:{$user.email}
                                </p>
                              </div>
                            </div>  
                        </div>
                        <div class="panel-footer">
                            <button type="button" onclick="editurl('__APP__/Discuss/user/id/{$user.id}/filter/1');" class="btn btn-primary btn-sm">一般评论</button>
                            <button type="button" onclick="editurl('__APP__/Discuss/user/id/{$user.id}/filter/2');" class="btn btn-info btn-sm">收费评论</button>
                            <button type="button" onclick="editurl('__APP__/Discuss/user/id/{$user.id}/filter/3');" class="btn btn-danger btn-sm">已屏蔽评论</button>
                        </div>
                    </div>
              
                </div>
                <div class="col-lg-12"> </div>   
            </div>
            <!-- /.row -->
            <div class="row" id="list">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            用户评论列表
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <div class="dataTable_wrapper">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th><center>参与评论的病例</center></th>
                                            <th><center>评论的内容</center></th>
                                            <th><center>是否收费</center></th>
                                            <th><center>当前状态</center></th>
                                            <th><center>创建时间</center></th>
                                            <th><center>评论时间</center></th>
                                            <th><center>操作</center></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <volist name="discuss" id="vo">
                                        <tr class="odd gradeX">
                                            <td>
                                                <center>
                                                    <button type="button" class="btn btn-warning btn-xs" data-toggle="modal" data-target="#exampleModal" data-whatever="{$vo.rec_id}" title="查看评论的病例">
                                                        <i class="glyphicon glyphicon-edit"></i>
                                                    </button>
                                                </center>
                                            </td>
                                            <td style="vertical-align: middle;"><center>{$vo.content}</center></td>
                                            <td style="vertical-align: middle;">
                                                <center>
                                                    <if condition="$vo.cashtype eq 1">
                                                        普通评论
                                                    <elseif condition="$vo.cashtype eq 2" />
                                                        收费未评论
                                                    <elseif condition="$vo.cashtype eq 3" />
                                                        收费已评论
                                                    <elseif condition="$vo.cashtype eq 4" />
                                                        收费未评论超时
                                                    </if>
                                                </center>
                                            </td>
                                            <td class="center" style="vertical-align: middle;">
                                                <center>
                                                    <if condition="$vo.pubtype neq 3">
                                                        <span class="label label-success">正常</span>
                                                    <else />
                                                        <span class="label label-danger">已屏蔽</span>
                                                    </if>
                                                </center>
                                            </td>
                                            <td style="vertical-align: middle;">
                                                <center>
                                                    {$vo.addtime|date="Y-m-d",###}
                                                </center>
                                            </td>
                                            <td style="vertical-align: middle;">
                                                <center>
                                                    {$vo.distime|date="Y-m-d",###}
                                                </center>
                                            </td>
                                            <td class="center" style="vertical-align: middle;">
                                                <center>
                                                    <button type="button" class="btn btn-success btn-xs" data-toggle="modal" data-target="#editModal" data-whatever="{$vo.id}">
                                                        <i class="fa fa-edit"></i>
                                                    </button>
                                                </center>
                                            </td> 
                                        </tr>
                                        </volist>
                                    </tbody>
                                </table>
                            </div>
                            <!-- /.table-responsive -->
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                {$page}
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            
        </div>
    <!-- Page-Level Demo Scripts - Tables - Use for reference -->
                <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                  <div class="modal-dialog modal-lg">
                    <div class="modal-content">
                      <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="exampleModalLabel">查看病例</h4>
                      </div>
                      <div class="modal-body">
                        <div class="row">
                            <div class="col-md-12">
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('gender')}
                                  </div>
                                  <div class="panel-body gender">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('age')}
                                  </div>
                                  <div class="panel-body age">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('complain')}
                                  </div>
                                  <div class="panel-body complain">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('history')}
                                  </div>
                                  <div class="panel-body history">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('oralhistory')}
                                  </div>
                                  <div class="panel-body oralhistory">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('profile')}
                                  </div>
                                  <div class="panel-body profile">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('normalcheck')}
                                  </div>
                                  <div class="panel-body normalcheck">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('specialcheck')}
                                  </div>
                                  <div class="panel-body specialcheck">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('diagnostic')}
                                  </div>
                                  <div class="panel-body diagnostic">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('major')}
                                  </div>
                                  <div class="panel-body major">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('tp')}
                                  </div>
                                  <div class="panel-body tp">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('rediagnosis')}
                                  </div>
                                  <div class="panel-body rediagnosis">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('prognosis')}
                                  </div>
                                  <div class="panel-body prognosis">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('imageupload')}
                                  </div>
                                  <div class="panel-body imageupload">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('discuss')}
                                  </div>
                                  <div class="panel-body discuss">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                              <div class="panel panel-default">
                                  <div class="panel-heading">
                                      {:L('praise')}
                                  </div>
                                  <div class="panel-body praise">
                                      
                                  </div>
                                  <div class="panel-footer">
                                  </div>
                              </div>
                            </div>
                        </div>
                      </div>
                      <div class="modal-footer">
                        <button type="button" class="btn btn-danger" data-dismiss="modal">关闭</button>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
                  <div class="modal-dialog">
                    <div class="modal-content">
                      <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="editModalLabel">编辑回复</h4>
                      </div>
                      <div class="modal-body">
                        <form>
                          <div class="form-group">
                            <label for="content-name" class="control-label">编辑内容</label>
                            <textarea class="form-control" id="content-name" rows="10"></textarea>
                            <input type="hidden" name="editid">
                          </div>
                        </form>
                      </div>
                      <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" id="edit-submit" class="btn btn-primary">提交</button>
                      </div>
                    </div>
                  </div>
                </div>
                <script type="text/javascript">
                    $('#editModal').on('show.bs.modal', function (event) {
                      var button = $(event.relatedTarget) // Button that triggered the modal
                      var recipient = button.data('whatever') // Extract info from data-* attributes
                      // If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
                      // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
                      var modal = $(this);
                      $.post("__APP__/Discuss/getcontent",{id:recipient},function(e){
                        modal.find('.modal-body textarea').val(e.content);
                        modal.find('.modal-body input').val(recipient);
                      })   
                    })

                    $("#edit-submit").on("click",function(){
                        var recipient=$('#editModal').find(".modal-body input").val();
                        var content = $('#editModal').find(".modal-body textarea").val();
                        $.post("__APP__/Discuss/postcontent",{id:recipient,content:content},function(e){
                            if(e.status==1){
                                $('#editModal').modal('hide');
                                editurl("__APP__/Discuss/user/id/{$userid}/filter/{$filter}/p/{$currentpage}");
                            }else{
                                alert("保存出错");
                            }
                        })
                    });
                    $('#exampleModal').on('show.bs.modal', function (event) {
                      var button = $(event.relatedTarget) // Button that triggered the modal
                      var recipient = button.data('whatever') // Extract info from data-* attributes
                      // If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
                      // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
                      var modal = $(this);
                      modal.find('.modal-body .imageupload').html("");
                      $.post("__APP__/Medicalrecord/getrecord",{id:recipient},function(e){
                        modal.find('.modal-body .gender').html(e.list.gender);
                        modal.find('.modal-body .age').html(e.list.age);
                        modal.find('.modal-body .complain').html(e.list.complain);
                        modal.find('.modal-body .history').html(e.list.history);
                        modal.find('.modal-body .oralhistory').html(e.list.oralhistory);
                        modal.find('.modal-body .history').html(e.list.history);
                        modal.find('.modal-body .profile').html(e.list.profile);
                        modal.find('.modal-body .normalcheck').html(e.list.normalcheck);
                        modal.find('.modal-body .specialcheck').html(e.list.specialcheck);
                        modal.find('.modal-body .diagnostic').html(e.list.diagnostic);
                        modal.find('.modal-body .major').html(e.list.major);
                        modal.find('.modal-body .tp').html(e.list.tp);
                        modal.find('.modal-body .rediagnosis').html(e.list.rediagnosis);
                        modal.find('.modal-body .prognosis').html(e.list.prognosis);
                        if(e.image){
                          $.each(e.image,function(k,v){
                            modal.find('.modal-body .imageupload').append("<img src='"+v.image+"' width='50' height='50'> ");
                          })
                        }
                        modal.find('.modal-body .discuss').html(e.list.discuss);
                        modal.find('.modal-body .praise').html(e.list.praise);
                      })
                      
                    })
                </script>

</body>

</html>
